package com.sc.nft.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sc.nft.admin.request.QueryActivityRankingDetailRequest;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.entity.dto.MallUserActivityRankingDetailDTO;
import com.sc.nft.service.MallUserActivityRankingDetailService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/user/activity/ranking/detail")
@Api(tags = "用户排行榜模块")
public class UserActivityRankingDetailController {

    private final MallUserActivityRankingDetailService mallUserActivityRankingDetailService;

    @PostMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "排行榜", notes = "排行榜", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<MallUserActivityRankingDetailDTO> queryActivityRankingCyclesList(@Valid @RequestBody QueryActivityRankingDetailRequest request) {
        IPage<MallUserActivityRankingDetailDTO> page = mallUserActivityRankingDetailService.queryMallUserActivityRankingDetailPage(request.toMp(),request.getCyclesId(),request.getPhone());
        return PageResult.success(page);
    }
}
